gtk/main: Keep implicit grab until all buttons are released
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 8 Dec 2020 22:13:50 +0000 (23:13 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 8 Dec 2020 22:27:03 +0000 (23:27 +0100)
commit43e484887264595049da292148fcf01bc12a1acc
tree578b4f85251f44b7c3aaf8416fb1b1331b56a7e5
parent80d4a08e306e36486e45542af0cdc58f5ad21e45
gtk/main: Keep implicit grab until all buttons are released

Currently, the implicit grab is broken on the first button release,
in the case of pressing multiple buttons simultaneously. This means
that we emit crossing events early, and the next button releases
are sent to the pointer focus widget instead.

Consider the implicit grab effective until all buttons are released,
and only unset the pointer implicit grab (and emit crossing events)
after there are no further buttons pressed. We do this by checking
event modifiers, given button release events do contain the modifiers
in effect at the time the event was generated, we have to look for
exactly one active button modifier.

Fixes weird pointer states after pressing multiple buttons on a
widget.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3426
gtk/gtkmain.c